<?php
require_once('../libraryfiles/config.php');
$content = 'reset_password.php';
$include='
<script src="' . base_url . 'js/jquery.validate.js" type="text/javascript"></script>
';
$site_title = 'Reset new password';
require_once TMP_USER_PATH;
$error = isset($_GET['error'])?$_GET['error']:'';
$email = isset($_GET['id'])?$_GET['id']:'';
$confirm = isset($_GET['confirm'])?$_GET['confirm']:'';
$check_reset = select(Tbluser::Tbluser, array(Tbluser::email,Tbluser::activate), array(Tbluser::email =>$email, Tbluser::activate=>$confirm));
$nums = mysql_num_rows($check_reset);
?>
<script type="text/javascript">
    $().ready(function() {
        $('#resetpassword').validate({
            rules: {
                txtpassword: {
                    required: true,
                    minlength: 6
                },
                txtconfirm: {
                    required: true,
                    minlength: 6,
                    equalTo: "#txtpassword"
                }
            },
            messages: {
                txtconfirm: {
                    required: "<?php echo $lang['INPUTPASSWORD']; ?>",
                    minlength: "<?php echo $lang['INPUT_PASSWORD_MIN']; ?>",
                    equalTo: "<?php echo $lang['INPUTVERIFYPASSWORD']; ?>"
                }
            }
        });
  });  
</script>
<div>
    <div class="span8 offset2">
        <div id="content" class="page">
            <h1 class="page-title"><?php echo $lang['PW_RESET']; ?></h1>
            <form action="<?php echo base_url; ?>account/process_foregetpassword.php" method="post" name="txtinputpass" id="resetpassword">
                <div class="page-content" >
                    <?php if(!empty($nums)):?>
                    <div class="content">
                        <table class="form" style="margin: 0">
                            <tr>
                                <td><label for="txtpassword"><?php echo $lang['PW_RESET_NEW']; ?></label></td>
                                <td><input class="required" type="password" name="txtpassword" id="txtpassword" value="" /></td>
                            </tr>
                        </table>
                        <input class="required" type="hidden" name="emailreset" id="txtemail" value="<?php echo $email;?>" />
                        <input class="required" type="hidden" name="activateid" id="activateid" value="<?php echo $confirm;?>" />
                    </div>
                    <div class="content">
                        <table class="form" style="margin: 0">
                            <tr>
                                <td><label for="txtconfirm"><?php echo $lang['PW_RESET_NEW_CONFIRM']; ?></label></td>
                                <td><input class="required" type="password" name="txtconfirm" id="txtconfirm" value="" /></td>
                            </tr>
                        </table>
                    </div>
                    <div class="buttons">
                        <div class="left"><a href="<?php echo base_url; ?>" class="button"><?php echo $lang['BACKK']; ?></a></div>
                        <div class="right">
                            <input type="submit" value="<?php echo $lang['SUBMIT']; ?>" class="button" />
                        </div>
                    </div>
                    <?php else:?>
                    <center><?php echo $lang['PW_RESET_NEW_NOT_EXIST'];?></center>
                    <?php endif;?>
                </div>
            </form>
        </div>
    </div>
</div>